package com.mooc;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;

public class RandomTransformer implements ClassFileTransformer {
    @Override
    public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
        if(className.contains("RandomUtil")){
            return ByteArrayUtil.getBytes("E:\\project\\demo\\agent\\doc\\RandomUtil.class");
        }
        return null;
    }
}
